using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Fan.Dongping.DataAccess;
using Fan.Dongping.Common.DBMeta;

public partial class TASK_Search : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack == false)
        {
            DataTable dt = WorkflowDA.GetWorkflows();
            foreach (DataRow dr in dt.Rows)
            {
                string workflowNo = dr[WorkflowMeta.WorkflowNoField].ToString();
                bool havePermission = PermissionDA.HaveWorkflowPermission(this.User.Identity.Name, workflowNo);
                if (havePermission)
                {
                    ListItem li = new ListItem(dr[WorkflowMeta.WorkflowNameField].ToString(), workflowNo);
                    DropDownWorkflow.Items.Add(li);
                }
            }
        }
    }


    protected void ButtonSearch_Click(object sender, EventArgs e)
    {
        string workflowNo = DropDownWorkflow.SelectedValue;
        DateTime beginTime = DateTime.Parse(TextBoxStartTime.Text);
        DateTime endTime = DateTime.Parse(TextBoxFinishTime.Text);
        string finishStatus = DropDownResolutionStatus.SelectedValue;
        string timeStatus = DropDownTimeStatus.SelectedValue;

        DataTable dt = ItemDA.GetItemsData(workflowNo, beginTime, endTime, finishStatus, timeStatus);
        GridViewItems.DataSource = dt;
        GridViewItems.DataBind();

        //string c01= UserDefinedColumnDA.GetColumnTitle(
    }

    protected void DropDownWorkflow_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
}
